Hi
I have a text box within a custom dialog box. I need a function to be called whenever the text within the text box is changed. Can this be done? I have tried using the following:
void changed(DBE text)
{
print "hello world"
}
dbeComments = text(myDialog, "Comments:", sComments, 300, 70, false)
set(dbeComments,changed)
It would also suffice to have the callback called whenever the user clicks the text box but on a text change only would be ideal.
Can this be done?
Cheers
Pete
Peter.Dawson - Thu May 21 22:04:14 EDT 2009 |
|
Re: TextBox DBE element text changed event Tony_Goodman - Fri May 22 03:28:49 EDT 2009
No, you can't do that.
Callbacks on change events will fire for DBEs that have a change in selection, such as checkBox, List and toggle.
Attaching a callback to a text or field element would not be practical anyway - how would you decide when to fire the callback? Every key click, on return?
Your best solution is to add a callback to a button and in this function check to see if the contents of the text box have changed using bool modified(DBE).
|
|
Re: TextBox DBE element text changed event Tony_Goodman - Fri May 22 03:32:42 EDT 2009 Tony_Goodman - Fri May 22 03:28:49 EDT 2009
No, you can't do that.
Callbacks on change events will fire for DBEs that have a change in selection, such as checkBox, List and toggle.
Attaching a callback to a text or field element would not be practical anyway - how would you decide when to fire the callback? Every key click, on return?
Your best solution is to add a callback to a button and in this function check to see if the contents of the text box have changed using bool modified(DBE).
The documentation suggests that you can use the following to attach a callback to any dialog box element other than a list view:
void set(DBE element, void select(DBE))
If you do this with a text box, there is no error but the callback does not fire.
|
|
Re: TextBox DBE element text changed event SystemAdmin - Fri May 22 04:16:58 EDT 2009 Tony_Goodman - Fri May 22 03:32:42 EDT 2009
The documentation suggests that you can use the following to attach a callback to any dialog box element other than a list view:
void set(DBE element, void select(DBE))
If you do this with a text box, there is no error but the callback does not fire.
For a field DBE this kind of callback fires when Return is pressed when the cursor is in field. But as you said, this does not work for text box.
|
|
Re: TextBox DBE element text changed event djakad - Fri May 22 12:14:25 EDT 2009 SystemAdmin - Fri May 22 04:16:58 EDT 2009
For a field DBE this kind of callback fires when Return is pressed when the cursor is in field. But as you said, this does not work for text box.
Try the attached DXL file.
In this work-around, I used the undocumented timer() function to constantly check for changes to the text box. It actually works quite well.
Thanks goes to Tony for teaching me about the timer() function in an older thread.
-Dave
Attachments
attachment_14254497_Simulated_TextBox_Callback_Using_Timer.dxl
|
|
Re: TextBox DBE element text changed event Peter.Dawson - Sun May 24 18:21:05 EDT 2009
Thanks all for your responses. The timer workaround should suit our application nicely.
Conceded, there is no callback on a textbox change. I confirm Tony's post that the "DBE set(DBE elem, select(void))" does not appear to do anything in the context of a text box.
|
|
Re: TextBox DBE element text changed event jmina - Tue May 22 17:19:16 EDT 2012 djakad - Fri May 22 12:14:25 EDT 2009
Try the attached DXL file.
In this work-around, I used the undocumented timer() function to constantly check for changes to the text box. It actually works quite well.
Thanks goes to Tony for teaching me about the timer() function in an older thread.
-Dave
I was having a similar issue as the initial user and the Simulated_TextBox_Callback is very useful !! thanks so much for the suggestion.
|
|